package com.atguigu.gulimall.ware.service;

import com.atguigu.common.to.OrderTo;
import com.atguigu.common.to.mq.StockLockedTo;
import com.atguigu.gulimall.ware.vo.SkuHasStockVo;
import com.atguigu.gulimall.ware.vo.WareSkuLockVo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.atguigu.common.utils.PageUtils;
import com.atguigu.gulimall.ware.entity.WareSkuEntity;

import java.util.List;
import java.util.Map;

/**
 * 商品库存
 *
 * @author fangdada
 * @email 1819675707@qq.com
 * @date 2021-05-01 11:08:19
 */
public interface WareSkuService extends IService<WareSkuEntity> {

	/**
	 * 分页查询
	 * @author fd
	 * @date 2021/9/16 15:47
	 * @param params 
	 * @return com.atguigu.common.utils.PageUtils
	 */
    PageUtils queryPage(Map<String, Object> params);

	/**
	 * 添加库存
	 * @author fd
	 * @date 2021/9/16 15:46
	 * @param skuId
	 * @param wareId
	 * @param skuNum 
	 */
    void addStock(Long skuId, Long wareId, Integer skuNum);

    /**
     * 查询sku是否有库存
     * @author fd
     * @date 2021/7/1 15:27
     * @param skuIds
     * @return java.util.List<com.atguigu.gulimall.ware.vo.SkuHasStockVo>
     */
	List<SkuHasStockVo> getSkuhasStock(List<Long> skuIds);

	/**
	 * 锁定库存
	 * @author fd
	 * @date 2021/9/16 15:47
	 * @param vo 
	 * @return boolean
	 */
    boolean orderLockStock(WareSkuLockVo vo);

	/**
	 * 解锁库存
	 * @author fd
	 * @date 2021/9/16 15:47
	 * @param to
	 */
	void unlockStock(StockLockedTo to);

	/**
	 * 解锁订单
	 * @author fd
	 * @date 2021/9/16 15:47
	 * @param orderTo
	 */
	void unlockStock(OrderTo orderTo);

}

